package com.zy.Conterller;

import com.zy.pojo.Bm;
import com.zy.service.BmService;
import com.zy.vo.ResultVo;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import javax.servlet.http.HttpSession;
import java.util.Date;

@RestController
@RequestMapping("/sys/plan")
public class BmCount {
    @Resource
    private BmService bmService;
    @GetMapping("list")
    public ResultVo list(){
        return ResultVo.success(bmService.list());
    }
    @PostMapping("/add")
    public ResultVo  add(@RequestBody Bm plan, HttpSession session){
        try{
            plan.setBmData(new Date());
            bmService.add(plan);
            return ResultVo.success("添加角色成功！");
        }catch (Exception e){
            return ResultVo.fail("角色添加失败",e);
        }
    }
}
